<template>
  <div class="body-box">
      <el-table size="mini" border :data="list.data">
          <el-table-column label="跑团名称" prop="Title"></el-table-column>
          <el-table-column label="ID" prop="IdCode"  width="60px"></el-table-column>
          <el-table-column label="团长" prop="Contacter" width="80px"></el-table-column>
          <el-table-column label="手机号" prop="Contact" width="100px"></el-table-column>
          <el-table-column label="城市" prop="City"></el-table-column>
          <el-table-column label="会员数" prop="user_num" width="60px"></el-table-column>
          <el-table-column label="活动数" prop="active_num" width="60px"></el-table-column>
          <el-table-column label="创建时间" prop="CreateTime" width="150px"></el-table-column>
          <el-table-column label="操作" width="180px">
              <template slot-scope="item">
                  <el-button size="mini" icon="el-icon-check" @click="setState(1,item.row.id)">同意</el-button>
                  <el-button size="mini" icon="el-icon-close" @click="setState(1,item.row.id)">拒绝</el-button>
              </template>
          </el-table-column>
      </el-table>
  </div>
</template>

<script>
export default {
    props:{model_style : {}},
    data(){
        return {
            list : {
                current_page : 1,
                data :[]
            }
        }
    },
    mounted(){
        //model_style == 1邀请2申请
        this.getData();
    },
    methods:{
        //获取列表数据
        getData(){
            this.ajaxs('club/getApplyList',{
                data : { is_apply : this.model_style == 1 ? false : true , page : this.list.current_page},
                success:(res) =>{
                    this.list = res.msg;
                    console.log(res);
                }
            });
        },
        //同意或拒绝
        setState(param,id){
            var url = param == 1 ? 'club/agreeChild' : 'club/refuseChild';
            this.ajaxs(url,{
                data : {id : id},
                success:(res) => {
                    this.toast(res.code,res.msg);
                    if(res.code) {
                        this.list.current_page =1;
                        this.getData();
                    }
                }
            });
        }
    }

}
</script>

<style>

</style>